Skip to contentSkip to conversation

Change in openvpn[master]: socks: In establish_socks_proxy_udpassoc check result of recv_socks_r...

Openvpn-devel In review flichtenheld (Code Review) 2 participants 6 messages Jan 13 – Jan 14 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1768308239000.Ic1c8f24de423541bdc85e70b5a688213800d86de@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/1469?usp=email

to review the following change.

Change subject: socks: In establish_socks_proxy_udpassoc check result of recv_socks_reply
......................................................................

socks: In establish_socks_proxy_udpassoc check result of recv_socks_reply

Not just check the return value but also that relay_addr is valid. recv_socks_reply doesn't care whether the answer is what we expected. This is probably a very unlikely edge case but it doesn't hurt to check for it here.

Github: openvpn-private-issues#13

Change-Id Ic1c8f24de423541bdc85e70b5a688213800d86de

---
M src/openvpn/socks.c

1 file changed, 6 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/1469/1

src/openvpn/socks.c +6 -2
index 078b4e1..5cb5912 100644
@@ -412,8 +412,7 @@
             send(ctrl_sd, "\x05\x03\x00\x01\x00\x00\x00\x00\x00\x00", 10, MSG_NOSIGNAL);
         if (size != 10)
         {
-            msg(D_LINK_ERRORS | M_ERRNO,
-                "establish_socks_proxy_passthru: TCP port write failed on send()");
+            msg(D_LINK_ERRORS | M_ERRNO, "%s: TCP port write failed on send()", __func__);
             goto error;
         }
     }
@@ -424,6 +423,11 @@
     {
         goto error;
     }
+    if (!relay_addr->addr.in4.sin_addr.s_addr)
+    {
+        msg(D_LINK_ERRORS, "%s: Socks proxy did not answer with IPv4 address", __func__);
+        goto error;
+    }
 
     return;
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1469?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newchange
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic1c8f24de423541bdc85e70b5a688213800d86de
Gerrit-Change-Number: 1469
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: flichtenheld, plaisthos.

cron2 has posted comments on this change by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1469?usp=email )

Change subject: socks: In establish_socks_proxy_udpassoc check result of recv_socks_reply
......................................................................

Patch Set 1: Code-Review+2

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1469?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: comment
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic1c8f24de423541bdc85e70b5a688213800d86de
Gerrit-Change-Number: 1469
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Attention: flichtenheld <[email protected]...>
Gerrit-Comment-Date: Wed, 14 Jan 2026 13:57:54 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes

#3 lore raw

PATCH 1/1 socks: In establish_socks_proxy_udpassoc check result of recv_socks_reply

In reply to a message not in the archive

From: Frank Lichtenheld <[email protected]...>

Not just check the return value but also that relay_addr is valid. recv_socks_reply doesn't care whether the answer is what we expected. This is probably a very unlikely edge case but it doesn't hurt to check for it here.

Github: openvpn-private-issues#13

Change-Id Ic1c8f24de423541bdc85e70b5a688213800d86de

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1469
---

This change was reviewed on Gerrit and approved by at least one developer. I request to merge it to master.

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1469
This mail reflects revision 1 of this Change.

Acked-by according to Gerrit (reflected above):
Gert Doering <[email protected]...>

src/openvpn/socks.c +6 -2
index 078b4e1..5cb5912 100644
@@ -412,8 +412,7 @@
             send(ctrl_sd, "\x05\x03\x00\x01\x00\x00\x00\x00\x00\x00", 10, MSG_NOSIGNAL);
         if (size != 10)
         {
-            msg(D_LINK_ERRORS | M_ERRNO,
-                "establish_socks_proxy_passthru: TCP port write failed on send()");
+            msg(D_LINK_ERRORS | M_ERRNO, "%s: TCP port write failed on send()", __func__);
             goto error;
         }
     }
@@ -424,6 +423,11 @@
     {
         goto error;
     }
+    if (!relay_addr->addr.in4.sin_addr.s_addr)
+    {
+        msg(D_LINK_ERRORS, "%s: Socks proxy did not answer with IPv4 address", __func__);
+        goto error;
+    }
 
     return;
 
#4 lore raw

[Openvpn-devel] [PATCH applied] Re: socks: In establish_socks_proxy_udpassoc check result of recv_socks_reply

We don't currently have "known failing" SOCKS test in our t_client setup (maybe we should, but the release t_client.sh script has no concept of "this test is expected to fail" yet), so this is not automatically tested.

That said, the change makes sense, and will hopefully ease someone's future debugging when talking to a SOCKS proxy that is refusing cooperation.

Your patch has been applied to the master branch.

commit b2cc5c2ec49c3cfc428f0ecef9684ac318845a84

Author: Frank Lichtenheld
Date:   Wed Jan 14 14:58:02 2026 +0100
     socks: In establish_socks_proxy_udpassoc check result of recv_socks_reply

     Signed-off-by: Frank Lichtenheld <[email protected]...>
     Acked-by: Gert Doering <[email protected]...>
     Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1469
     Message-Id: <[email protected]...>
     URL: https://www.mail-archive.com/[email protected]/msg35249.html
     Signed-off-by: Gert Doering <[email protected]...>

--
kind regards,

Gert Doering

#5 lore raw
In reply to a message not in the archive

cron2 has uploaded a new patch set (#2) to the change originally created by flichtenheld. ( http://gerrit.openvpn.net/c/openvpn/+/1469?usp=email )

The following approvals got outdated and were removed:
Code-Review+2 by cron2

Change subject: socks: In establish_socks_proxy_udpassoc check result of recv_socks_reply
......................................................................

socks: In establish_socks_proxy_udpassoc check result of recv_socks_reply

Not just check the return value but also that relay_addr is valid. recv_socks_reply doesn't care whether the answer is what we expected. This is probably a very unlikely edge case but it doesn't hurt to check for it here.

Github: openvpn-private-issues#13

Change-Id Ic1c8f24de423541bdc85e70b5a688213800d86de

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1469
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35249.html

---
M src/openvpn/socks.c

1 file changed, 6 insertions(+), 2 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/69/1469/2

src/openvpn/socks.c +6 -2
index 078b4e1..5cb5912 100644
@@ -412,8 +412,7 @@
             send(ctrl_sd, "\x05\x03\x00\x01\x00\x00\x00\x00\x00\x00", 10, MSG_NOSIGNAL);
         if (size != 10)
         {
-            msg(D_LINK_ERRORS | M_ERRNO,
-                "establish_socks_proxy_passthru: TCP port write failed on send()");
+            msg(D_LINK_ERRORS | M_ERRNO, "%s: TCP port write failed on send()", __func__);
             goto error;
         }
     }
@@ -424,6 +423,11 @@
     {
         goto error;
     }
+    if (!relay_addr->addr.in4.sin_addr.s_addr)
+    {
+        msg(D_LINK_ERRORS, "%s: Socks proxy did not answer with IPv4 address", __func__);
+        goto error;
+    }
 
     return;
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1469?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: newpatchset
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic1c8f24de423541bdc85e70b5a688213800d86de
Gerrit-Change-Number: 1469
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>

#6 lore raw
In reply to a message not in the archive

cron2 has submitted this change. ( http://gerrit.openvpn.net/c/openvpn/+/1469?usp=email )

Change subject: socks: In establish_socks_proxy_udpassoc check result of recv_socks_reply
......................................................................

socks: In establish_socks_proxy_udpassoc check result of recv_socks_reply

Not just check the return value but also that relay_addr is valid. recv_socks_reply doesn't care whether the answer is what we expected. This is probably a very unlikely edge case but it doesn't hurt to check for it here.

Github: openvpn-private-issues#13

Change-Id Ic1c8f24de423541bdc85e70b5a688213800d86de

Gerrit URL: https://gerrit.openvpn.net/c/openvpn/+/1469
Message-Id: <[email protected]...>
URL: https://www.mail-archive.com/[email protected]/msg35249.html

---
M src/openvpn/socks.c

1 file changed, 6 insertions(+), 2 deletions(-)
src/openvpn/socks.c +6 -2
index 078b4e1..5cb5912 100644
@@ -412,8 +412,7 @@
             send(ctrl_sd, "\x05\x03\x00\x01\x00\x00\x00\x00\x00\x00", 10, MSG_NOSIGNAL);
         if (size != 10)
         {
-            msg(D_LINK_ERRORS | M_ERRNO,
-                "establish_socks_proxy_passthru: TCP port write failed on send()");
+            msg(D_LINK_ERRORS | M_ERRNO, "%s: TCP port write failed on send()", __func__);
             goto error;
         }
     }
@@ -424,6 +423,11 @@
     {
         goto error;
     }
+    if (!relay_addr->addr.in4.sin_addr.s_addr)
+    {
+        msg(D_LINK_ERRORS, "%s: Socks proxy did not answer with IPv4 address", __func__);
+        goto error;
+    }
 
     return;
 

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/1469?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings?usp=email

Gerrit-MessageType: merged
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: Ic1c8f24de423541bdc85e70b5a688213800d86de
Gerrit-Change-Number: 1469
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: cron2 <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>